#pragma once
#ifndef __stdafx_h_
#define __stdafx_h_
// stdafx.h

// Ogre headers you need
#include <OgreException.h>
#include <OgreRoot.h>
#include <OgreConfigFile.h>
#include <OgreCamera.h>
#include <OgreViewport.h>
#include <OgreSceneManager.h>
#include <OgreRenderWindow.h>
#include <OgreEntity.h>
#include <OgreWindowEventUtilities.h>
#include "Ogre.h"
#include "OgreStringConverter.h"
#include "OgreException.h"
#include "ExampleApplication.h"

//#include "ExampleApplication.h"
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#include "../res/resource.h"
#endif
#include "OgreBulletDynamicsRigidBody.h"				 // for OgreBullet

//OculusSDK header files
#include "OVR.h"
#include "OgreSceneManager.h"
#include "OgreRenderWindow.h"
#include "OgreCompositorManager.h"
#include "OgreCompositorInstance.h"
#include "OgreCompositionTargetPass.h"
#include "OgreCompositionPass.h"

//Audio
#include "OgreOggSound.h"

//GUI
#include "Gorilla.h"
struct D3Panel
{

	D3Panel(Gorilla::Silverback* silverback, Ogre::SceneManager* sceneMgr, const Ogre::Vector2& size)
		: mD3PanelSize(size)
	{

		mD3PanelScreen = silverback->createScreenRenderable(Ogre::Vector2(mD3PanelSize.x,mD3PanelSize.y), "dejavu");
		mD3PanelNode = sceneMgr->getRootSceneNode()->createChildSceneNode();
		mD3PanelNode->attachObject(mD3PanelScreen);

		mD3PanelGUILayer = mD3PanelScreen->createLayer(0);
		mD3PanelBackground = mD3PanelGUILayer->createRectangle(0,0, mD3PanelSize.x * 100, mD3PanelSize.y * 100);
		mD3PanelBackground->background_gradient(Gorilla::Gradient_NorthSouth, Gorilla::rgb(94,97,255,5), Gorilla::rgb(94,97,255,50));
		mD3PanelBackground->border(2, Gorilla::rgb(255,255,255,150));

	}

	~D3Panel()
	{
		mD3PanelScreen->destroy(mD3PanelGUILayer);
	}

	Gorilla::Caption* makeCaption(Ogre::Real x, Ogre::Real y, const Ogre::String& text)
	{
		return mD3PanelGUILayer->createCaption(14, x, y, text);
	}

	//Need to keep track of visibility separately because there is no access to isVisible inside Ogre::SceneNode.
	void setVisible(bool vis)
	{
		mD3PanelNode->setVisible(vis);
		isVisible = vis;
	}

	Gorilla::ScreenRenderable*		mD3PanelScreen;
	Ogre::SceneNode*				mD3PanelNode;
	Gorilla::Layer*					mD3PanelGUILayer;
	Gorilla::Rectangle*				mD3PanelBackground;
	Ogre::Vector2					mD3PanelSize;
	bool							isVisible;
};

struct Waypoint
{

	Waypoint(Vector3 position, Real maxRadius, Real maxSpeed)
	{
		mPosition = position;
		mMaxRadius = maxRadius;
		mMaxSpeed = maxSpeed;
	}

	~Waypoint()
	{

	}

	Vector3 mPosition;
	Real mMaxRadius;
	Real mMaxSpeed;
};

struct TimingGate
{

	TimingGate(Vector3 c, Real r)
	{
		center = c;
		radius = r;
	}

	~TimingGate()
	{

	}

	Vector3 center;
	Real radius;
};

enum GameState
{
	LOADING,
	COUNTDOWN,
	RACING,
	PAUSED,
	RACEEND
};

enum QueryFlags
{
	ANY_QUERY_MASK					= 1<<0,
	RAGDOLL_QUERY_MASK				= 1<<1,
	GEOMETRY_QUERY_MASK				= 1<<2,
	VEHICLE_QUERY_MASK				= 1<<3,
	STATIC_GEOMETRY_QUERY_MASK		= 1<<4
};

// any other header can be included, as usual
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif
#endif // #ifndef __stdafx_h_